It is common in computer systems to have one or more output ports that control other devices. A few examples of such devices are indicator lights, video displays, speakers, and disks, as well as devices that control the computer system itself such as timers and interrupt controllers. Often, the processor needs to know the current setting of these output ports. Prior art includes two different mechanisms to provide this function, either by adding extra logic to make the output port readable by the processor, or by requiring the processor software to maintain its own independent copy of the current setting in the computer memory.
Referring now to FIG. 1, a typical computer system is referred to generally by reference numeral 10. Computer system 10 includes a processor and bus control logic 12 and a memory 14 which allows the processor to read and write a variety of stored information. An output port 16 allows the processor to control an output device 18. At least one input port 20 allows the processor to read the current setting of the output port. Other input ports 22 may be included to read information from input devices 24, such as a keyboard or timer. Decode logic 26 is used to translate the processor and bus logic ADDRESS into the chip-selects required to activate the memory and ports when the processor requests them. The decode logic maps the ports either to the processor's memory or to Input/output addresses. Finally, the processor and bus logic produces READ and WRITE signals to activate the memory and ports during processor read and write accesses respectively.
Computer systems with this design allow output port 16 to be read by the processor through input port 20, but extra logic is required to implement this input port, which requires more components and more physical space, or more complex components, and in either case more cost.
The other prior art mechanism used in some computer systems avoids this cost by leaving out input port logic 20 and relying on the software to maintain the setting of output port 16 by performing additional accesses to store and recall the setting from memory 14. This reduces the cost of the logic, but increases the execution time and memory space required by the software. Furthermore, this can complicate or even make it impossible for loosely coupled software programs to interact with the hardware because it may be difficult or impossible for one program to know the state in which another program has set the output port.